﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class user_findmyfriend : Wozuji.Logic.PageLogin
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (!searchValue.Text.ToString().Equals(""))
        {
            try
            {
                DataSet ds = new DataSet();
                Wozuji.BLL.Member_t mbbll = new Wozuji.BLL.Member_t();
                String wherestr = "member_friendname='" + searchValue.Text.ToString().Replace("'", "''") + "' or member_email='" + searchValue.Text.ToString().Replace("'", "''") + "' or member_name='" + searchValue.Text.ToString().Replace("'", "''") + "'";
                ds = mbbll.GetList(wherestr);
                if (!(ds == null))
                {
                    result.Text = "";
                    //绑定数据
                   

                    PagedDataSource objPds = new PagedDataSource();

                    objPds.DataSource = ds.Tables[0].DefaultView;

                    objPds.AllowPaging = true;
                    objPds.PageSize = 5;
                    int CurPage;
                    if (Request.QueryString["Page"] != null)
                        CurPage = Convert.ToInt32(Request.QueryString["Page"]);
                    else
                        CurPage = 1;

                    objPds.CurrentPageIndex = CurPage - 1;
                    lblCurrentPage.Text = "当前页：" + CurPage.ToString();

                    if (!objPds.IsFirstPage)
                        lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);

                    if (!objPds.IsLastPage)
                        lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);



                    Repeater1.DataSource = objPds;
                    Repeater1.DataBind();
                }
                else
                {
                    result.Text = "搜索到0个结果<br>对不起没有找到您要寻找的朋友";
                }
            }

            catch (Exception ex)
            {
                result.Text = "搜索到0个结果<br>对不起没有找到您要寻找的朋友";
            }

        }
    }
}
